import request from "@/utils/request";
import type { HospitalResponseData, HospitalLevelAndRegponseData, HospitalInfo } from "./type";

enum API {
    //获取已有医院的数据接口地址
    HOSPITAL_URL = '/hosp/hospital/',
    //获取医院等级与地区接口
    HOSDPITALLEVELANDREGION_URL = '/cmn/dict/findByDictCode/',
    //根据关键字获取医院数据
    HOSPITALINFO_URL = '/hosp/hospital/findByHosname/'

}
//获取医院的数据
export const getHospitalAPI = (page: number, limit: number, hostype = '', districtCode = '') => {
    return request.get<any, HospitalResponseData>(API.HOSPITAL_URL + `${page}/${limit}?hostype=${hostype}&districtCode=${districtCode}`)
}

//获取医院等级或地区的数据
export const getHospitalLevelAndRegionAPI = (dictCode: string) => {
    return request.get<any, HospitalLevelAndRegponseData>(API.HOSDPITALLEVELANDREGION_URL + dictCode)
}

//根据关键字获取医院数据进行展示
export const getHospitalInfoAPI = (hosname: string) => {
    return request.get<any, HospitalInfo>(API.HOSPITALINFO_URL + hosname)
}

